package com.ppc.utils;

import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
import java.util.List;

/**
 * 敏感词，demo类，到时候删掉
 *
 * @author jianKangS1
 * @date 2023/12/20
 */
public class SensitiveTestDemo {

  /**
   * @param args
   * @description
   */
  public static void main(String[] args) {
    SensitiveTestDemo sensitiveTestDemo = new SensitiveTestDemo();
    sensitiveTestDemo.testSensitive();
    sensitiveTestDemo.returnFirstSensitive();
    sensitiveTestDemo.returnAllSensitive();
    sensitiveTestDemo.replaceSensitive();
  }

  /**
   * @description
   *///是否含敏感词
  void testSensitive() {
    final String text = "五星红旗迎风飘扬，画像屹立在天安门前。";
    boolean contains = SensitiveWordBs.newInstance().contains(text);
    System.out.println("text " + text + " contains sensitive words  " + contains);
  }

  /**
   * @description
   *///返回第一个敏感词
  void returnFirstSensitive() {
    final String text = "我的";

    String word = SensitiveWordBs.newInstance().findFirst(text);
    System.out.println("first sensitive  " + word);

  }

  /**
   * @description
   *///返回第一个敏感词
  void returnAllSensitive() {
    final String text = "五星红旗迎风飘扬，画像屹立在天安门前。";

    List<String> wordList = SensitiveWordBs.newInstance().findAll(text);
    System.out.println("first sensitive  " + wordList);

  }

  /**
   * @description
   */
  void replaceSensitive() {
    final String text = "五星红旗迎风飘扬，画像屹立在天安门前。";
    String result = SensitiveWordBs.newInstance().replace(text);
    System.out.println(result);
  }

}
